﻿using System.Collections.Generic;
using System.Windows;
using System.Linq;

namespace WindowsPhoneAudioStreaming.Audio.Streaming 
{
    public class ConfigurationSetup
    {
        public string ProgramUrl { get; set; }
        public string NowPlayingUrl { get; set; }
        public List<AudioStreamDefinition> Streams { get; set; }

        public ConfigurationSetup()
        {
            this.ProgramUrl = "";
            this.NowPlayingUrl = "";
            this.Streams = new List<AudioStreamDefinition>();
        }

        /// <summary>
        /// Load the current configuration
        /// </summary>
        /// <returns></returns>
        public static ConfigurationSetup LoadConfiguration()
        {
            ConfigurationSetup currentSetup = new ConfigurationSetup();
            currentSetup = Application.Current.Resources["Configuration"] as ConfigurationSetup;
            return currentSetup;
            //if (currentSetup != null)
            //{
            //    var streamingPlaylist = currentSetup.Streams.Select(s =>
            //                            new Audio.Streaming.StreamingRadioTrackDefinition()
            //                            {
            //                                ImageUri = s.ImageUri,
            //                                StreamUri = s.StreamUri,
            //                                Title = s.Title
            //                            });

            //    currentSetup.Playlist = streamingPlaylist.ToList();
            //    return currentSetup;
            //}

            //return new ConfigurationSetup();
        }
    }

   

}
